
			mui.init({
		        pullRefresh: {
		          container: '#pullrefresh',
		         down: {
		            callback: pulldownRefresh
		          },
		          up: {
		            contentrefresh: '正在加载...',
		            callback: pullupRefresh
		          }
		        }
	      	});
	      	var count = 0;
	      	//如果不赋值的话不会出现上拉加载
			var totalNumber   ;//总条数
			//http://106.14.139.5:7014/GZ/v1/mpc/queryMulti?pageNo=1&pageSize=10
			var url=XHDOC_WEBBASE+'v1/mpc/queryMulti?pageSize=10';
			
			function listajax(type,url,count){
				
				ajaxUtil('get', url, {state:type,usrid:XHDOC_APP_USRID,pageNo:count}, function(data){
				 	var html = '';
				 	totalNumber = data.data.totalPage;

					$('.mui-content').css("display","none"); 
				 	if (totalNumber == 0) {
						$('.mui-content').css("display","block")
						
					} else{
						$('.mui-content').css("display","none") 
						
					}
				 	if (data.code==000) {
				 		var data=data.data.parameterType;
				 		console.log(data);
				 		
				 		
				 		for (var i=0;i<data.length;i++) {
				 			var ishtml =''; 
				 			var ifrecievehtml = ''; //接受拒绝
				 			//只有创建者本人才能删除关闭，不是创建人本人不能关闭 ,状态位是3的时候没有拒绝跟接受
				 			if (XHDOC_APP_USRID == data[i].crtusr) {
				 				if (type == 0 ) {
						 			ishtml='<a class="mui-btn mui-btn-red oy-mui-btn">删除</a>'+
											'<a class="mui-btn oy-btn-close oy-mui-btn">关闭</a>';
								} else{
						 			ishtml='<a class="mui-btn mui-btn-red oy-mui-btn">删除</a>';
						 		}
				 			}else{
				 				
				 				if (data[i].stat == 3||type =='1') {
				 				
					 			} else{
					 				ifrecievehtml = '<div class="mui-col-xs-4 ifrecieve ">'+
														'<a class="mui-btn mui-btn-red ifis">接受</a>'+									
														'<a class="mui-btn mui-btn-red ifis">拒绝</a>'+
													'</div>'
					 			}
				 			}
				 			
				 			
					 		html +=
					 			'<li class="mui-table-view-cell" data-crtusr='+data[i].crtusr+' data-guid='+data[i].guid+' data-title='+data[i].name+'>'+
									'<div class="mui-slider-right mui-disabled">'+
										ishtml+
									'</div>'+
									'<div class="mui-slider-handle mui-row">'+
										'<div class="mui-col-xs-8">'+
											'<p class="bgname">'+data[i].name+'</p>'+									
											'<p class="">创建人：'+data[i].usr+'</p>'+
											'<p class="">开始时间：'+data[i].dat+'</p>'+
										'</div>'+
										ifrecievehtml+
									'</div>'+
								'</li>'
						}	
				 			$("#OA_task_2").append(html);
				 	} else{
				 		mui.toast("数据加载失败");
				 	}
				 })
			}
			/**
			   * 下拉刷新具体业务实现
			*/
		  	function pulldownRefresh() {
			    setTimeout(function() {
			    	
			     	mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
			    	
			    },500);
		    
		  	}
			/**
			   * 上拉加载具体业务实现
			*/
		  	function pullupRefresh() {
		        setTimeout(function() { 
		          mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count >= totalNumber+1)); //参数为true代表没有更多数据了。
					listajax(type,url,count)
					
		        }, 500);
		  	}
	
		  	if(mui.os.plus) {
		        mui.plusReady(function() {
		          	setTimeout(function() {
		            	mui('#pullrefresh').pullRefresh().pullupLoading();
		      		}, 500);
		
		        });
		  	} else {
		        mui.ready(function() {
		          mui('#pullrefresh').pullRefresh().pullupLoading();
		        });
		  	}
		//删除接口	https://tsch.fromfuture.cn:7714/GZ/Docpre/updateState?id=174BD3D5879C3BF0E050007F010077DC
		
		var btnArray = ['确认', '取消'];
		var content;
		//第二个demo，向左拖拽后显示操作图标，释放后自动触发的业务逻辑
		mui('#OA_task_2').on('tap', '.oy-mui-btn', function(event) {
			var elem = this;
			var id = $(this).parents('li').data("guid");
			var biaozhi = $(this).html();
			//console.log(id);
			var url = '';
			if (biaozhi == '删除') {
				 content= '确认删除该条记录？'
				url=XHDOC_WEBBASE+'v1/mpc/deleteMutil';
			} else{
				 content= '确认关闭该条记录？'
				url=XHDOC_WEBBASE+'v1/mpc/closeMutil';
			}
			var li = elem.parentNode.parentNode;		
			mui.confirm(content, '提示', btnArray, function(e) {
				if (e.index == 0) {
					ajaxUtil('post', url, {refid:id}, function(data){
					 	console.log(data);
					 	if (data.code==000) {
					 		if (biaozhi == '删除') {
					 			mui.toast("删除成功");
					 		} else{
					 			mui.toast("关闭成功");
					 		}
					 		
					 		li.parentNode.removeChild(li);
					 		setTimeout(function(){
					 			
					 		},200)
					 	} else{
					 		mui.toast("删除失败");
					 		
					 	}
					 })
				} else {
					setTimeout(function() {
						mui.swipeoutClose(li);
					}, 0);
				}
				
			});
		});
		/*点击接受或者拒绝*/
		mui('#OA_task_2').on('tap','.ifis',function(event){
			 event.stopPropagation();
			 var ckflg = '';
			 if ($(this).text() == '接受') {
			 	ckflg = 1;
			 } else{
			 	ckflg = 2;
			 }
			 var value = $(this).parents("li").data('guid');//诊室的guid
			 var mycrtusr = $(this).parents("li").data('crtusr')//创建人的id
			 console.log(value);
			 //var url=XHDOC_WEBBASE+'v1/mpc/commit?refid=e45642b05e5145df8dcdb3d15d19606b&inviteusrid=zcc&ckflg=2&usrid=zc';
			var url=XHDOC_WEBBASE+'v1/mpc/commit';
			ajaxUtil('get', url, {refid:value,usrid:XHDOC_APP_USRID,inviteusrid:XHDOC_APP_USRID,ckflg:ckflg}, function(data){
				console.log(data);
				setTimeout(function(){
					location.reload();	
				},200)
			})
			
			
			
		})
		
		
		function entrypage(a,b){
			/*点击打开编辑页面*/
			mui('#OA_task_2').on('tap', '.mui-table-view-cell', function(event) {
				 event.stopPropagation();
				var id = $(this).data("guid");
				var title = $(this).data("title");
				var content = this.getAttribute("data-content");
				var extras = {'id':id};
				 newobj.setItem("extras1",extras);
			 	if(!mui.os.plus) {
			 	alert(a+'?id='+id);
					location.href =a+'?id='+id;
				}else{
				alert(a+" "+{id:id,title:title,content:content});
					showpage(a, a,{id:id,title:title,content:content})
					
				}
				 

			});
			/*打开新建页面*/
			mui("body").on('tap', '.mybutton', function(event) {
				 showpage(b, b)
			})
		}
		
		
		
		
